<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'obj.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" rev="stylesheet"	href="<%=basePath%>css/Listing_Index.css" type="text/css">
		<link rel="stylesheet" rev="stylesheet" href="<%=basePath%>css/admin-v1.css" type="text/css">
		<style>
			.red{
			border:1px red solid;
			}
			.white{
			border:0px;
			}
		
		</style>
	
	</head>

	<body>
		<div class="admin_right_title">
			<h1>
				发布租房信息
			</h1>
		</div>
		<!-- admin_right_title end -->
		<div class="admin_right_content">
			<form id="form" action="<%=basePath%>/admin/renthome/save.do" method="post" enctype="multipart/form-data" onsubmit="return sub()">
				<dl class="content_dl">
					<dt>
						<label>
							标题：
						</label>
						<input type="hidden" name="id" value="${home.id}"/>
						<input type="hidden" name="type" value="rent"/>
						<input class="inputText_25_200" type="text" name="name" id="name" value="${home.name}" />
					</dt>
					<dt>
						<label>
							地区：
						</label>
							<select name="zone" id="zone">
								<c:forEach var="zone" items="${zoneList}">
								<option value="${zone.code}" <c:if test="${zone.code==home.zone}">selected</c:if>>${zone.name}</option>
								</c:forEach>
							</select>
					</dt>
					<dt>
						<label>
							小区：
						</label>
						<input class="inputText_25_200" type="text" name="address" value="${home.address}" id="address"/>
					</dt>
					<dt>
						<label>
							户型：
						</label>
						<select name="houseType" id="houseType">
							<c:forEach var="houseType" items="${houseTypeList}">
								<option value="${houseType.code}" <c:if test="${houseType.code==home.houseType}">selected</c:if>>${houseType.name}</option>
							</c:forEach>
						</select>
					</dt>
					<dt>
						<label>
							楼层：
						</label>
						第
						<input class="inputText_25_30" id="floor" type="text" name="floor" value="${home.floor}" />
						层
					</dt>
					<dt>
						<label>
							装修：
						</label>
						<select name="fix" id="fix">
							<c:forEach var="fix" items="${fixList}">
								<option value="${fix.code}" <c:if test="${fix.code==home.fix}">selected</c:if>>${fix.name}</option>
							</c:forEach>
						</select>
					</dt>
					<dt>
						<label>
							面积
						</label>
						<input class="inputText_25_30" type="text" name="area" value="${home.area }" id="area"/>平方米
					<dt>
						<label>
							房龄
						</label>
						<select name="houseAge" id="houseAge">
							<c:forEach var="age" items="${houseAgeList}">
								<option value="${age.code}" <c:if test="${age.code==home.houseAge}">selected</c:if>>${age.name}</option>
							</c:forEach>
						</select>
					</dt>
					<dt>
						<label>
							出租方式：
						</label>
						<select name="rentWay" id="rentWay">
							<option value="all" <c:if test="${home.rentWay=='all'}">selected</c:if>>
								整租
							</option>
							<option value="half" <c:if test="${home.rentWay=='half'}">selected</c:if>>
								合租
							</option>
						</select>
					</dt>
					<dt>
						<label>
							租金：
						</label>
						<input class="inputText_25_200" type="text" name="price" id="price" value="${home.price}" />
						元/月
					</dt>
					<dt>
						<label>房子用途</label>
						<select name="houseUse">
							<c:forEach var="use" items="${houseUseList}">
								<option value="${use.code}" <c:if test="${use.code==home.houseUse}">selected</c:if>>${use.name}</option>
							</c:forEach>
						</select>
					</dt>
					
					<dt>
						<label>
							朝向：
						</label>
						<select name="face" id="face">
							<option value="E" <c:if test="${home.face=='E'}">selected</c:if>>朝东</option>
							<option value="S" <c:if test="${home.face=='S'}">selected</c:if>>朝南</option>
							<option value="W" <c:if test="${home.face=='W'}">selected</c:if>>朝西</option>
							<option value="N" <c:if test="${home.face=='N'}">selected</c:if>>朝北</option>
						</select>
					
					</dt>
					<dt>
						<label>
							配置：
						</label>
						<textarea name="provide" id="provide">${home.provide}</textarea>
					</dt>
					<dt>
						<label>
							室内图：
						</label>
						<input type="file" name="imgFile"  id="imgFile"/>
						<input type="hidden" name="smallIcon" value="${home.smallIcon}" />
						<input type="hidden" name="bigIcon" value="${home.smallIcon}" />
					
					</dt>
					<dt>
					<c:choose>
						<c:when test="${home eq null || home.smallIcon eq null || home.smallIcon eq ''}">
							<img src="<%=basePath%>images/default_image.gif"/>
						</c:when>
						<c:otherwise>
							<img src="<%=basePath%>img/${home.smallIcon}" width="100" height="100"/>
						</c:otherwise>
					</c:choose>
					</dt>
					
					<dt class="">
						<input class="inputButton_25_80" type="submit" />
					</dt>
				</dl>
			</form>
			
			<script src="<%=basePath%>admin/common/validata.js"></script>
			<script type="text/javascript">
				Validata.registerRequire(['name','zone','address','houseType','fix','area','floor','price']);
				Validata.registerNumber(['area','price']);
				Validata.registerImg(['imgFile']);
				function sub(){
					return Validata.validata();
					
				}
			</script>
			
		</div>
	</body>
</html>
